package vashion.azeroth.core.item.pojo;

/**
 * 商品会员价计算规则
 * Created by liuhe on 15/11/28.
 */
public class ItemVipPriceRule {

    private static final double LEVEL_1_DISCOUNT = 0.95;//一级
    private static final double LEVEL_2_DISCOUNT = 0.90;//二级
    private static final double LEVEL_3_DISCOUNT = 0.85;//三级

    /**
     * 计算vip价格
     *
     * @param price
     * @param vipLevel
     * @return
     */
    public static long getVipPrice(long price, int vipLevel) {
        if (vipLevel <= 0) {
            return price;
        }
        switch (vipLevel) {
            case 1:
                return new Double(price * LEVEL_1_DISCOUNT).intValue();
            case 2:
                return new Double(price * LEVEL_2_DISCOUNT).intValue();
            case 3:
                return new Double(price * LEVEL_3_DISCOUNT).intValue();
        }
        return price;
    }
}
